﻿@model OpenKeyViewModel
<h5 class="bg-light text-dark text-start p-2">@Model.Action</h5>
<form method="post" asp-action="@Model.Action">
    <div asp-validation-summary="All" class="text-danger text-start"></div>
    <div class="form-control">
        <label asp-for="OpenKey.OpenKeyId"></label>
        <input class="form-control" asp-for="OpenKey.OpenKeyId" readonly/>
    </div>

    <div class="form-control">
        <label asp-for="OpenKey.Key"></label>
        <div>
            <span asp-validation-for="OpenKey.Key" class="text-danger"></span>
        </div>
        <input class="form-control" asp-for="OpenKey.Key" readonly="@Model.ReadOnly"/>
    </div>
    <div class="form-control">
        <label asp-for="OpenKey.PricingMethod"></label>
        <div>
            <span asp-validation-for="OpenKey.PricingMethod" class="text-danger"></span>
        </div>

        <select class="form-control" asp-for="OpenKey.PricingMethod" disabled="@Model.ReadOnly"
                asp-items="@Model.PricingSelector">
        </select>
    </div>
    <div class="form-control">
        <label asp-for="OpenKey.AvailableRequest"></label>
        <div>
            <span asp-validation-for="OpenKey.AvailableRequest" class="text-danger"></span>
        </div>

        <input class="form-control" asp-for="OpenKey.AvailableRequest" readonly="@Model.ReadOnly"/>
    </div>
    <div class="form-control">
        <label asp-for="OpenKey.AvailableRequestToken"></label>
        <div>
            <span asp-validation-for="OpenKey.AvailableRequestToken" class="text-danger"></span>
        </div>

        <input class="form-control" asp-for="OpenKey.AvailableRequestToken" readonly="@Model.ReadOnly"/>
    </div>
    <div class="form-control">
        <label asp-for="OpenKey.Balance"></label>
        <div>
            <span asp-validation-for="OpenKey.Balance" class="text-danger" readonly="@Model.ReadOnly"></span>
        </div>

        <input class="form-control" asp-for="OpenKey.Balance"/>
    </div>
    <div class="form-control">
        <label asp-for="OpenKey.KeyUserId"></label>
        <div>
            <span asp-validation-for="OpenKey.KeyUserId" class="text-danger"></span>
        </div>

        <select class="form-control" asp-for="OpenKey.KeyUserId" disabled="@Model.ReadOnly"
                asp-items="@Model.KeyUserSelector"></select>
    </div>
    <div class="form-control">
        <label asp-for="OpenKey.Available"></label>
        <div>
            <span asp-validation-for="OpenKey.Available" class="text-danger"></span>
        </div>

        <select class="form-control" asp-for="OpenKey.Available" disabled="@Model.ReadOnly" asp-items="@Model.AvailableSelector"></select>
    </div>
    @if (Model.ShowAction)
    {
        <button class="btn btn-secondary" type="submit">@Model.Action</button>
    }
    <a class="btn btn-secondary" asp-controller="OpenKey" asp-action="Index">Back</a>
</form>